write.xls <- function(x,
                      filename,
                      sheetName="fromR",
                      writeColNms=TRUE,
                      writeRowNms=TRUE,
                      formats=NULL,
                      row.name.formats=NULL,
                      alignColNmsRight=TRUE,
                      freezePlane=TRUE)
{
    if(typeof(x)=="list" && !is.data.frame(x)) {
        sheetName <- NULL
    }

    if(class(x)=="rseries" && is.null(row.name.formats)) {
        row.name.formats <- "yyyy-mm-dd"
    }
    
    invisible(.Call("R2xls",x,filename,sheetName,writeColNms,writeRowNms,formats,row.name.formats,alignColNmsRight,freezePlane,PACKAGE="Rexcelpoi"))
}
